//
//  IndexGridButton.m
//  CarTown
//
//  Created by 熊浩 on 15/8/1.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "IndexGridButton.h"

@implementation IndexGridButton
-(void)awakeFromNib{
    self.titleLabel.textAlignment=NSTextAlignmentCenter;
    self.imageView.contentMode=UIViewContentModeScaleAspectFit;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(CGRect)imageRectForContentRect:(CGRect)contentRect{

    CGFloat height=42;
    CGFloat y=10;
    CGFloat x=(contentRect.size.width-height)/2;
    CGFloat width=height;
    return CGRectMake(x, y, width, height);
}

-(CGRect)titleRectForContentRect:(CGRect)contentRect{
    CGFloat height=contentRect.size.height-50-4;
    CGFloat x=0;
    CGFloat y=50+4;
    CGFloat width=contentRect.size.width;
    return CGRectMake(x, y, width, height);
}
@end
